package xyz.thoughtset.viewer.common.exc.service;

import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import xyz.thoughtset.viewer.common.crud.core.service.BaseServiceImpl;
import xyz.thoughtset.viewer.common.exc.dao.ExcInfoDao;
import xyz.thoughtset.viewer.common.exc.entity.ExcInfo;

import java.util.LinkedHashMap;
import java.util.Objects;

@Slf4j
@Service
public class ExcInfoServiceImpl extends BaseServiceImpl<ExcInfoDao, ExcInfo> implements ExcInfoService {

    @Override
    public boolean save(ExcInfo entity) {
        try {
            entity.setParamStr(mapper.writeValueAsString(entity.getParams()));
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return super.save(entity);
    }
}
